package cn.autumnorange.app.util.api;


import cn.autumnorange.app.common.dto.ResultDto;
import cn.autumnorange.app.common.rpc.lock.RPCIdempotentLockTarget;
import cn.autumnorange.app.util.api.dto.OrderDto;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.lang.annotation.Annotation;
import java.util.List;

/**
 * @author wsf
 * @time 2019/6/6 21:47
 */
@FeignClient(value = "app-util-provider", fallbackFactory = TimeServiceFallbackFactory.class)
public interface TimeService {
  @RPCIdempotentLockTarget(rpcLock = "timestamp")
  @GetMapping(value = "timeService/{timestamp}")
  ResponseEntity<ResultDto<String>> timestampToYYMMDD(
          @PathVariable(value = "timestamp") long timestamp);

  @RPCIdempotentLockTarget(rpcLock = "className")
  @GetMapping(value = "getAnnotation/{className}/{methodName}/{annotationName}")
  ResponseEntity<ResultDto<String>> getAnnotation(@PathVariable(value = "className") String className, @PathVariable(value = "methodName") String methodName, @PathVariable(value = "annotationName") String annotationName);

  @RPCIdempotentLockTarget(rpcLock = "childrenDto#childrenDto2#idc")
  @PostMapping(value = "updOrder")
  ResponseEntity<ResultDto<OrderDto>> updOrder(@RequestBody OrderDto orderDto) throws Exception;

}
